<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<!DOCTYPE html>
<html class="bgfff">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title>名教风采</title>
</head>
<body>
	<jsp:include page="/WEB-INF/page/common/_header.jsp" />
	<jsp:include page="/WEB-INF/page/common/head.jsp" />
	<div class="mjfc-content">
		<p>小林体育多年来凭借其科学、规范的教学内容，严谨的考级缺席，高水平专业化的教练员队伍，诚信、优质的服务水平，专业、正规的训练场地，合理的消费价位赢得了广大学员的赞誉，经过多年的努力已累积有数千名学员练习跆拳道，并曾多次参加全国、省级、市级比赛，并获得优异的成绩。</p>
		<p>道馆以俱乐部制形式，力行“世界跆拳道聪明”的正统训练模式，其训练程序可归纳为：坚强一信心一勇气一自持一反省一判断一自卫一独立一沉着一领导一合作一忠孝。科学分班、保证教学质量按年龄：幼儿班、少儿班、成人班。</p>
	</div>
	<div id="list-content">
	
	</div>
	<script id="table-template" type="text/x-handlebars-template">
		{{#each list}}		
		<div class="mjfc-title">
			<div><h4>{{type}}</h4></div>
		</div>
		<div class="mjfc-content">
			<div class="mjfc-picList clearfix">
				{{#each results}}	
				<a href="{{url}}">				
				<p>
					<img src="${config.imgUrl}{{picUrl}}"/><br>
					{{name}}
				</p>
				</a>
				{{/each}}
			</div>
		</div>
		{{/each}}
	</script>
	<jsp:include page="/WEB-INF/page/common/_footer.jsp"></jsp:include>
	<script type="text/javascript">
		loadItem();
		function loadItem() {
			$.ajax({
			    type: 'post',
			    url: '<%=basePath %>/media/list',
			    data: {
			    	authorType: "教练团队"
			    },
			    dataType: 'json',
			    cache:false,
			    success: function(data) {
			    	var myTemplate = Handlebars.compile($("#table-template").html());
					var allList = new Array();
					var singleList = new Array();
					var map = new Map();
					for(var i = 0; i < data.results.length; i++) {
						var author = data.results[i].author;
						var list = map.get(author);
						if(list != null) {
							list.push(data.results[i]);
						}else {
							var array = new Array();
							array.push(data.results[i]);
							map.set(author, array);
						}
					}
					map.forEach(function(value ,key ,map) {
						allList.push({"type": key, "results": value}); 
					});
					var result = {};
					result.list = allList;
			    	$("#list-content").append(myTemplate(result));
			    },
			    error:function(){
	            	alert("系统异常，请稍后再试！");
	            }
			});
		}
	</script>
</body>
</html>